package designMode.iteratorPattern;

import java.util.List;

/**
 * @author LIBOFEI
 * @ClassName PancakeHouseMenuIterator
 * @description
 * @date 2020/6/26 16:31
 * @Version 1.0
 **/
public class PancakerHouseMenuIterator implements java.util.Iterator<MenuItem>{

    List<MenuItem> items;
    int position = 0;

    public PancakerHouseMenuIterator(List<MenuItem> menuItems){
        this.items = menuItems;
    }

    @Override
    public boolean hasNext() {
        if(position >= items.size() || items.get(position) == null){
            return false;
        }
        return true;
    }



    @Override
    public MenuItem next() {
        MenuItem menuItem = items.get(position);
        position++;
        return menuItem;
    }



    @Override
    public void remove() {
        //TODO something
    }
}
